package com.game.framework;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;

import java.util.ArrayList;
import java.util.List;

///  xs游戏骨架
@Configuration
public class XsGameSkeleton implements ApplicationContextAware {
    public static final List<Class<? extends IManager>> managerClasses = new ArrayList<>();


    @Override
    public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException {
        // loading Game Framework

        // 设置Spring context上下文
        SpringManager.getInstance().setContext(applicationContext);

        // 核心管理器注册
        CoreManager.getInstance().registerManager(SpringManager.getInstance());
        CoreManager.getInstance().registerManager(ActorManager.getInstance());

        CoreManager.getInstance().init();      // 对所有manager进行初始化
    }
}
